3.64 \(\int \frac {\cot (c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx\)

Optimal. Leaf size=162 \[ \frac {15 A+i B}{16 a^4 d (1+i \tan (c+d x))}+\frac {7 A+i B}{16 a^4 d (1+i \tan (c+d x))^2}-\frac {x (-B+15 i A)}{16 a^4}+\frac {A \log (\sin (c+d x))}{a^4 d}+\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3} \]

[Out]

-1/16*(15*I*A-B)*x/a^4+A*ln(sin(d*x+c))/a^4/d+1/16*(7*A+I*B)/a^4/d/(1+I*tan(d*x+c))^2+1/16*(15*A+I*B)/a^4/d/(1
+I*tan(d*x+c))+1/8*(A+I*B)/d/(a+I*a*tan(d*x+c))^4+1/12*(3*A+I*B)/a/d/(a+I*a*tan(d*x+c))^3

________________________________________________________________________________________

Rubi [A]  time = 0.49, antiderivative size = 162, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {3596, 3531, 3475} \[ \frac {15 A+i B}{16 a^4 d (1+i \tan (c+d x))}+\frac {7 A+i B}{16 a^4 d (1+i \tan (c+d x))^2}-\frac {x (-B+15 i A)}{16 a^4}+\frac {A \log (\sin (c+d x))}{a^4 d}+\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3} \]

Antiderivative was successfully verified.

[In]

Int[(Cot[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^4,x]

[Out]

-(((15*I)*A - B)*x)/(16*a^4) + (A*Log[Sin[c + d*x]])/(a^4*d) + (7*A + I*B)/(16*a^4*d*(1 + I*Tan[c + d*x])^2) +
 (15*A + I*B)/(16*a^4*d*(1 + I*Tan[c + d*x])) + (A + I*B)/(8*d*(a + I*a*Tan[c + d*x])^4) + (3*A + I*B)/(12*a*d
*(a + I*a*Tan[c + d*x])^3)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3596

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[((a*A + b*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^(n + 1))/(2
*f*m*(b*c - a*d)), x] + Dist[1/(2*a*m*(b*c - a*d)), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Si
mp[A*(b*c*m - a*d*(2*m + n + 1)) + B*(a*c*m - b*d*(n + 1)) + d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x], x], x], x
] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] &&  !GtQ[n,
0]

Rubi steps

\begin {align*} \int \frac {\cot (c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx &=\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {\int \frac {\cot (c+d x) (8 a A-4 a (i A-B) \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx}{8 a^2}\\ &=\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3}+\frac {\int \frac {\cot (c+d x) \left (48 a^2 A-12 a^2 (3 i A-B) \tan (c+d x)\right )}{(a+i a \tan (c+d x))^2} \, dx}{48 a^4}\\ &=\frac {7 A+i B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3}+\frac {\int \frac {\cot (c+d x) \left (192 a^3 A-24 a^3 (7 i A-B) \tan (c+d x)\right )}{a+i a \tan (c+d x)} \, dx}{192 a^6}\\ &=\frac {7 A+i B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3}+\frac {15 A+i B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}+\frac {\int \cot (c+d x) \left (384 a^4 A-24 a^4 (15 i A-B) \tan (c+d x)\right ) \, dx}{384 a^8}\\ &=-\frac {(15 i A-B) x}{16 a^4}+\frac {7 A+i B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3}+\frac {15 A+i B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}+\frac {A \int \cot (c+d x) \, dx}{a^4}\\ &=-\frac {(15 i A-B) x}{16 a^4}+\frac {A \log (\sin (c+d x))}{a^4 d}+\frac {7 A+i B}{16 a^4 d (1+i \tan (c+d x))^2}+\frac {A+i B}{8 d (a+i a \tan (c+d x))^4}+\frac {3 A+i B}{12 a d (a+i a \tan (c+d x))^3}+\frac {15 A+i B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.43, size = 193, normalized size = 1.19 \[ \frac {\sec ^4(c+d x) (16 (21 A+4 i B) \cos (2 (c+d x))+3 \cos (4 (c+d x)) (128 A \log (\sin (c+d x))-120 i A d x+A+8 B d x+i B)+288 i A \sin (2 (c+d x))+360 A d x \sin (4 (c+d x))-3 i A \sin (4 (c+d x))+384 i A \sin (4 (c+d x)) \log (\sin (c+d x))+96 A-32 B \sin (2 (c+d x))+3 B \sin (4 (c+d x))+24 i B d x \sin (4 (c+d x))+36 i B)}{384 a^4 d (\tan (c+d x)-i)^4} \]

Antiderivative was successfully verified.

[In]

Integrate[(Cot[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^4,x]

[Out]

(Sec[c + d*x]^4*(96*A + (36*I)*B + 16*(21*A + (4*I)*B)*Cos[2*(c + d*x)] + 3*Cos[4*(c + d*x)]*(A + I*B - (120*I
)*A*d*x + 8*B*d*x + 128*A*Log[Sin[c + d*x]]) + (288*I)*A*Sin[2*(c + d*x)] - 32*B*Sin[2*(c + d*x)] - (3*I)*A*Si
n[4*(c + d*x)] + 3*B*Sin[4*(c + d*x)] + 360*A*d*x*Sin[4*(c + d*x)] + (24*I)*B*d*x*Sin[4*(c + d*x)] + (384*I)*A
*Log[Sin[c + d*x]]*Sin[4*(c + d*x)]))/(384*a^4*d*(-I + Tan[c + d*x])^4)

________________________________________________________________________________________

fricas [A]  time = 0.64, size = 121, normalized size = 0.75 \[ \frac {{\left ({\left (-744 i \, A + 24 \, B\right )} d x e^{\left (8 i \, d x + 8 i \, c\right )} + 384 \, A e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) + 24 \, {\left (13 \, A + 2 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + 12 \, {\left (8 \, A + 3 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 8 \, {\left (3 \, A + 2 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 3 \, A + 3 i \, B\right )} e^{\left (-8 i \, d x - 8 i \, c\right )}}{384 \, a^{4} d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="fricas")

[Out]

1/384*((-744*I*A + 24*B)*d*x*e^(8*I*d*x + 8*I*c) + 384*A*e^(8*I*d*x + 8*I*c)*log(e^(2*I*d*x + 2*I*c) - 1) + 24
*(13*A + 2*I*B)*e^(6*I*d*x + 6*I*c) + 12*(8*A + 3*I*B)*e^(4*I*d*x + 4*I*c) + 8*(3*A + 2*I*B)*e^(2*I*d*x + 2*I*
c) + 3*A + 3*I*B)*e^(-8*I*d*x - 8*I*c)/(a^4*d)

________________________________________________________________________________________

giac [A]  time = 2.10, size = 165, normalized size = 1.02 \[ -\frac {\frac {12 \, {\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{4}} + \frac {12 \, {\left (31 \, A + i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{4}} - \frac {384 \, A \log \left (\tan \left (d x + c\right )\right )}{a^{4}} - \frac {775 \, A \tan \left (d x + c\right )^{4} + 25 i \, B \tan \left (d x + c\right )^{4} - 3460 i \, A \tan \left (d x + c\right )^{3} + 124 \, B \tan \left (d x + c\right )^{3} - 5898 \, A \tan \left (d x + c\right )^{2} - 246 i \, B \tan \left (d x + c\right )^{2} + 4612 i \, A \tan \left (d x + c\right ) - 252 \, B \tan \left (d x + c\right ) + 1447 \, A + 153 i \, B}{a^{4} {\left (\tan \left (d x + c\right ) - i\right )}^{4}}}{384 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="giac")

[Out]

-1/384*(12*(A - I*B)*log(tan(d*x + c) + I)/a^4 + 12*(31*A + I*B)*log(tan(d*x + c) - I)/a^4 - 384*A*log(tan(d*x
 + c))/a^4 - (775*A*tan(d*x + c)^4 + 25*I*B*tan(d*x + c)^4 - 3460*I*A*tan(d*x + c)^3 + 124*B*tan(d*x + c)^3 -
5898*A*tan(d*x + c)^2 - 246*I*B*tan(d*x + c)^2 + 4612*I*A*tan(d*x + c) - 252*B*tan(d*x + c) + 1447*A + 153*I*B
)/(a^4*(tan(d*x + c) - I)^4))/d

________________________________________________________________________________________

maple [A]  time = 0.80, size = 259, normalized size = 1.60 \[ -\frac {A \ln \left (\tan \left (d x +c \right )+i\right )}{32 d \,a^{4}}+\frac {i B \ln \left (\tan \left (d x +c \right )+i\right )}{32 d \,a^{4}}+\frac {A \ln \left (\tan \left (d x +c \right )\right )}{a^{4} d}+\frac {B}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )}-\frac {15 i A}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )}-\frac {B}{12 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{3}}+\frac {i A}{4 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{3}}-\frac {7 A}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{2}}-\frac {i B}{16 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{2}}+\frac {A}{8 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{4}}+\frac {i B}{8 d \,a^{4} \left (\tan \left (d x +c \right )-i\right )^{4}}-\frac {i \ln \left (\tan \left (d x +c \right )-i\right ) B}{32 d \,a^{4}}-\frac {31 \ln \left (\tan \left (d x +c \right )-i\right ) A}{32 d \,a^{4}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x)

[Out]

-1/32/d/a^4*A*ln(tan(d*x+c)+I)+1/32*I/d/a^4*B*ln(tan(d*x+c)+I)+1/a^4/d*A*ln(tan(d*x+c))+1/16/d/a^4/(tan(d*x+c)
-I)*B-15/16*I/a^4/d/(tan(d*x+c)-I)*A-1/12/d/a^4/(tan(d*x+c)-I)^3*B+1/4*I/a^4/d/(tan(d*x+c)-I)^3*A-7/16/d/a^4/(
tan(d*x+c)-I)^2*A-1/16*I/a^4/d/(tan(d*x+c)-I)^2*B+1/8/d/a^4/(tan(d*x+c)-I)^4*A+1/8*I/d/a^4/(tan(d*x+c)-I)^4*B-
1/32*I/d/a^4*ln(tan(d*x+c)-I)*B-31/32/d/a^4*ln(tan(d*x+c)-I)*A

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 6.67, size = 196, normalized size = 1.21 \[ \frac {\frac {7\,A}{4\,a^4}-{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (-\frac {B}{16\,a^4}+\frac {A\,15{}\mathrm {i}}{16\,a^4}\right )-{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {13\,A}{4\,a^4}+\frac {B\,1{}\mathrm {i}}{4\,a^4}\right )+\frac {B\,1{}\mathrm {i}}{3\,a^4}+\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {19\,B}{48\,a^4}+\frac {A\,63{}\mathrm {i}}{16\,a^4}\right )}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^4-{\mathrm {tan}\left (c+d\,x\right )}^3\,4{}\mathrm {i}-6\,{\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}+1\right )}+\frac {A\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{a^4\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{32\,a^4\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (31\,A+B\,1{}\mathrm {i}\right )}{32\,a^4\,d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cot(c + d*x)*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i)^4,x)

[Out]

((7*A)/(4*a^4) - tan(c + d*x)^3*((A*15i)/(16*a^4) - B/(16*a^4)) - tan(c + d*x)^2*((13*A)/(4*a^4) + (B*1i)/(4*a
^4)) + (B*1i)/(3*a^4) + tan(c + d*x)*((A*63i)/(16*a^4) - (19*B)/(48*a^4)))/(d*(tan(c + d*x)*4i - 6*tan(c + d*x
)^2 - tan(c + d*x)^3*4i + tan(c + d*x)^4 + 1)) + (A*log(tan(c + d*x)))/(a^4*d) + (log(tan(c + d*x) + 1i)*(A*1i
 + B)*1i)/(32*a^4*d) - (log(tan(c + d*x) - 1i)*(31*A + B*1i))/(32*a^4*d)

________________________________________________________________________________________

sympy [A]  time = 1.03, size = 362, normalized size = 2.23 \[ \frac {A \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a^{4} d} + \begin {cases} \frac {\left (\left (24576 A a^{12} d^{3} e^{12 i c} + 24576 i B a^{12} d^{3} e^{12 i c}\right ) e^{- 8 i d x} + \left (196608 A a^{12} d^{3} e^{14 i c} + 131072 i B a^{12} d^{3} e^{14 i c}\right ) e^{- 6 i d x} + \left (786432 A a^{12} d^{3} e^{16 i c} + 294912 i B a^{12} d^{3} e^{16 i c}\right ) e^{- 4 i d x} + \left (2555904 A a^{12} d^{3} e^{18 i c} + 393216 i B a^{12} d^{3} e^{18 i c}\right ) e^{- 2 i d x}\right ) e^{- 20 i c}}{3145728 a^{16} d^{4}} & \text {for}\: 3145728 a^{16} d^{4} e^{20 i c} \neq 0 \\x \left (- \frac {- 31 i A + B}{16 a^{4}} - \frac {\left (31 i A e^{8 i c} + 26 i A e^{6 i c} + 16 i A e^{4 i c} + 6 i A e^{2 i c} + i A - B e^{8 i c} - 4 B e^{6 i c} - 6 B e^{4 i c} - 4 B e^{2 i c} - B\right ) e^{- 8 i c}}{16 a^{4}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (31 i A - B\right )}{16 a^{4}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**4,x)

[Out]

A*log(exp(2*I*d*x) - exp(-2*I*c))/(a**4*d) + Piecewise((((24576*A*a**12*d**3*exp(12*I*c) + 24576*I*B*a**12*d**
3*exp(12*I*c))*exp(-8*I*d*x) + (196608*A*a**12*d**3*exp(14*I*c) + 131072*I*B*a**12*d**3*exp(14*I*c))*exp(-6*I*
d*x) + (786432*A*a**12*d**3*exp(16*I*c) + 294912*I*B*a**12*d**3*exp(16*I*c))*exp(-4*I*d*x) + (2555904*A*a**12*
d**3*exp(18*I*c) + 393216*I*B*a**12*d**3*exp(18*I*c))*exp(-2*I*d*x))*exp(-20*I*c)/(3145728*a**16*d**4), Ne(314
5728*a**16*d**4*exp(20*I*c), 0)), (x*(-(-31*I*A + B)/(16*a**4) - (31*I*A*exp(8*I*c) + 26*I*A*exp(6*I*c) + 16*I
*A*exp(4*I*c) + 6*I*A*exp(2*I*c) + I*A - B*exp(8*I*c) - 4*B*exp(6*I*c) - 6*B*exp(4*I*c) - 4*B*exp(2*I*c) - B)*
exp(-8*I*c)/(16*a**4)), True)) - x*(31*I*A - B)/(16*a**4)

________________________________________________________________________________________